﻿// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the 
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

using System;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows;
using FeatureDemo.Helper;

namespace FeatureOverview.Features.Shell
{
    [Feature("Application Bar", "Features of the application bar", 7.0)]
    public partial class ApplicationBarSample : 
        PhoneApplicationPage
    {
        public ApplicationBarSample()
        {
            InitializeComponent();

            ApplicationBar = new ApplicationBar();

            #region Buttons

            ApplicationBarIconButton btn1 = new ApplicationBarIconButton();
            btn1.Text = "Button 1";
            btn1.IconUri = new Uri("/Assets/Icons/dark/appbar.add.rest.png", UriKind.Relative);
            btn1.Click += (s, e) =>
            {
                // Do something
                MessageBox.Show("Button 1 clicked");
            };
            ApplicationBar.Buttons.Add(btn1);

            btn1 = new ApplicationBarIconButton();
            btn1.Text = "Button 2";
            btn1.IconUri = new Uri("/Assets/Icons/dark/appbar.back.rest.png", UriKind.Relative);
            btn1.Click += (s, e) =>
            {
                // Do something
                MessageBox.Show("Button 2 clicked");
            };
            ApplicationBar.Buttons.Add(btn1);

            btn1 = new ApplicationBarIconButton();
            btn1.Text = "Button 3";
            btn1.IconUri = new Uri("/Assets/Icons/dark/appbar.basecircle.rest.png", UriKind.Relative);
            btn1.Click += (s, e) =>
            {
                // Do something
                MessageBox.Show("Button 3 clicked");
            };
            ApplicationBar.Buttons.Add(btn1);


            btn1 = new ApplicationBarIconButton();
            btn1.Text = "Button 4";
            btn1.IconUri = new Uri("/Assets/Icons/dark/appbar.upload.rest.png", UriKind.Relative);
            btn1.Click += (s, e) =>
            {
                // Do something
                MessageBox.Show("Button 4 clicked");
            };
            ApplicationBar.Buttons.Add(btn1);

            ApplicationBar.IsVisible = true;

            #endregion

            #region MenuItems

            ApplicationBarMenuItem menuItem1 = new ApplicationBarMenuItem();
            menuItem1.Text = "Settings";
            menuItem1.Click += (s, e) =>
                {
                    MessageBox.Show("Settings clicked");
                };
            ApplicationBar.MenuItems.Add(menuItem1);

            ApplicationBarMenuItem menuItem2 = new ApplicationBarMenuItem();
            menuItem2.Text = "Undo";
            menuItem2.Click += (s, e) =>
            {
                MessageBox.Show("Undo clicked");
            };
            ApplicationBar.MenuItems.Add(menuItem2);

            ApplicationBarMenuItem menuItem3 = new ApplicationBarMenuItem();
            menuItem3.Text = "Change profile";
            menuItem3.Click += (s, e) =>
            {
                MessageBox.Show("Change profile clicked");
            };
            ApplicationBar.MenuItems.Add(menuItem3);

            #endregion
        }
    }
}